<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,user-scalable=no" />
    <title>NCUT 猫</title>
    <!-- jquery -->
    <script src="./lib/jquery.min.js"></script>
    <script src="./lib/jquery.form.js"></script>
    <!-- popper -->
    <script src="./lib/popper.min.js"></script>
    <!-- Bootstrap -->
    <link rel="stylesheet" href="./lib/bootstrap.min.css">
    <link rel="stylesheet" href="./lib/bootstrap-theme.min.css">
    <script src="./lib/bootstrap.min.js"></script>
    <script src="./lib/bootstrap.bundle.min.js"></script>
    <!-- vue -->
    <script src="./lib/vue.js"></script>
    <!-- js -->
    <script src="./js/ConstData.js"></script>
    <script src="./js/navManager.js"></script>
    <script src="./js/foot-tab-bar.js"></script>
    <!-- css -->
    <link rel="stylesheet" type="text/css" href="./css/mainFrame.css">
    <link rel="stylesheet" type="text/css" href="./css/tab-bar.css">
    <link rel="stylesheet" type="text/css" href="./css/me.css">
    <link rel="stylesheet" type="text/css" href="./css/cat_list.css">
    <!-- icon -->
    <script src="./icon/iconfont.js"></script>
    <style type="text/css">
    .icon {
        width: 1em;
        height: 1em;
        vertical-align: -0.15em;
        fill: currentColor;
        overflow: hidden;
    }
    </style>
</head>

<body>
    <span class="module-list">
        <span class="module l-module" onclick="window.location.href='/public/cloud-cat.html'" style="height: auto;min-height: 20vw;">
            <span class="title" id="type_title"></span>
        </span>
        <div id="main"></div>
        <span id="admin_module" class="module l-module admin_module" style="display: none;">
            <svg class="icon sketch" aria-hidden="true" onclick="window.location.href='/public/admin.html#create_cat'">
                <use xlink:href="#icon-tianjia"></use>
            </svg>
        </span>
        <script type="text/javascript">
        (() => {
            let theRequest = {};

            (function GetRequest() {
                let url = location.search; //获取url中"?"符后的字串
                if (url.indexOf("?") != -1) {
                    let str = url.substr(1);
                    let strs = str.split("&");
                    for (let i = 0; i < strs.length; i++) {
                        let x = strs[i].split("=");
                        theRequest[x[0]] = unescape(x[1]);
                    }
                }
            })();
            let type = theRequest.type;
            let status = theRequest.status;
            let color = getTableNameValues('basic_info', 'color')[type];
            let tar = $("#main");
            let hasCat = false;
            for (let index in all_cats_info) {
                let cat = all_cats_info[index];
                if (color && cat.e != type) continue;
                switch (status) {
                    case '0':
                        if (cat.o || cat.ay) continue;
                        break;
                    case '1':
                        if (cat.o || !cat.ay) continue;
                        break;
                    case '2':
                        if (!cat.o) continue;
                        break;
                }

                let element = `<span class="module l-module infoLine"
                 onclick="window.location.href='/public/cat_info.html?id=${cat.a||-1}'"><img class="sketch" src="/img/cat/${cat.aa}"><svg class="icon mark-icon" aria-hidden="true"><use xlink:href="#icon-paw"></use></svg><span class="name">${cat.b||'匿名'}</span><span class="autograph">${cat.c||''} - ${cat.d||''}</span><span class="follow">关注</span></span>`;
                tar.append(element);
                hasCat = true;
            }
            $("#type_title").html(`猫咪列表: ${color || '所有'}`);
            if (!hasCat) {
                tar.append('<span class="module l-module"><span class="title" id="type_title">暂无猫咪</span></span>')
            }
            login_check(success => {
                if (userInfo['create_cat']) $("#admin_module").show();
            })
        })();
        </script>
    </span>
</body>

</html>